/*
 Navicat Premium Dump SQL

 Source Server         : 唯恩
 Source Server Type    : MySQL
 Source Server Version : 80024 (8.0.24)
 Source Host           : 192.168.10.203:3306
 Source Schema         : firelink_inspection_work

 Target Server Type    : MySQL
 Target Server Version : 80024 (8.0.24)
 File Encoding         : 65001

 Date: 17/02/2025 17:53:28
*/

SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for comment
-- ----------------------------
DROP TABLE IF EXISTS `comment`;
CREATE TABLE `comment` (
  `id` varchar(36) NOT NULL COMMENT '主键ID',
  `knowledge_id` varchar(36) NOT NULL COMMENT '知识ID',
  `user_name` varchar(40) DEFAULT NULL COMMENT '用户名',
  `content` mediumtext COMMENT '评论内容',
  `time` datetime DEFAULT NULL COMMENT '评论时间',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT COMMENT='评论';

-- ----------------------------
-- Records of comment
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for dict
-- ----------------------------
DROP TABLE IF EXISTS `dict`;
CREATE TABLE `dict` (
  `id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '主键id',
  `name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '名称',
  `groupname` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '组名',
  `sortid` int DEFAULT NULL COMMENT '排序字段',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT COMMENT='字典表';

-- ----------------------------
-- Records of dict
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for fire_department
-- ----------------------------
DROP TABLE IF EXISTS `fire_department`;
CREATE TABLE `fire_department` (
  `id` varchar(36) NOT NULL COMMENT '主键id',
  `name` varchar(50) DEFAULT NULL COMMENT '名称',
  `pid` varchar(36) DEFAULT NULL COMMENT '父级id',
  `level` int DEFAULT NULL COMMENT '等级',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT COMMENT='消防主管部门';

-- ----------------------------
-- Records of fire_department
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for industry_authorities
-- ----------------------------
DROP TABLE IF EXISTS `industry_authorities`;
CREATE TABLE `industry_authorities` (
  `id` varchar(36) DEFAULT NULL COMMENT '主键id',
  `name` varchar(50) DEFAULT NULL COMMENT '名称',
  `pid` varchar(36) DEFAULT NULL COMMENT '父级id',
  `level` int DEFAULT NULL COMMENT '等级'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT COMMENT='行业主管部门';

-- ----------------------------
-- Records of industry_authorities
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for inspection_work
-- ----------------------------
DROP TABLE IF EXISTS `inspection_work`;
CREATE TABLE `inspection_work` (
  `id` varchar(36) NOT NULL COMMENT '主键id',
  `title` varchar(50) DEFAULT NULL COMMENT '任务标题',
  `type` varchar(36) DEFAULT NULL COMMENT '检查类型:数据来源于字典表中的检查类型',
  `des` varchar(255) DEFAULT NULL COMMENT '任务描述',
  `starttime` datetime DEFAULT NULL COMMENT '开始时间',
  `lowerhairtime` datetime DEFAULT NULL COMMENT '任务下发时间',
  `org_id` varchar(36) DEFAULT NULL COMMENT '创建机构id',
  `create_person_id` varchar(36) DEFAULT NULL COMMENT '创建人id',
  `ishave_file` tinyint(1) DEFAULT '0' COMMENT '是否有附件：0 没有 1 有',
  `ishave_receiving_unit` tinyint(1) DEFAULT '0' COMMENT '是否有接收单位：0 没有 1 有',
  `org_name` varchar(50) DEFAULT NULL COMMENT '机构名称',
  `allflag` tinyint(1) DEFAULT '0' COMMENT '选择下属所有企业 1 是  0 否',
  `area` varchar(500) DEFAULT NULL COMMENT '行政区划id(包括上级的id，从上往下排，中间逗号隔开)',
  `bottom_area` varchar(50) DEFAULT NULL COMMENT '选择的行政区划id',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT COMMENT='检查工作下发';

-- ----------------------------
-- Records of inspection_work
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for notice_announcement
-- ----------------------------
DROP TABLE IF EXISTS `notice_announcement`;
CREATE TABLE `notice_announcement` (
  `id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci NOT NULL COMMENT '主键',
  `announcement_type` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '通告类型id: 对应字典表中的数据：会议通告  奖惩通告  活动通告  其它',
  `content_des` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '内容描述',
  `state` tinyint(1) DEFAULT '0' COMMENT '通告状态:0 暂存草稿  1 直接发布',
  `ishave_receiving_unit` tinyint(1) DEFAULT '0' COMMENT '是否有接收单位：0 没有 1 有',
  `ishave_file` tinyint(1) DEFAULT '0' COMMENT '是否有附件：0 没有 1 有',
  `publishtime` datetime DEFAULT NULL COMMENT '发布时间',
  `create_person_id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '创建人id',
  `is_del` tinyint(1) DEFAULT '0' COMMENT '是否已经删除（0 没有  1 删除）',
  `createtime` datetime DEFAULT NULL COMMENT '创建时间',
  `org_id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '创建机构id',
  `org_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '机构名称',
  `allflag` tinyint(1) DEFAULT '0' COMMENT '选择下属所有企业 1 是  0 否',
  `area` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '行政区划id(包括上级的id，从上往下排，中间逗号隔开)',
  `bottom_area` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '选择的行政区划id',
  `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '名称',
  `contacts` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '联系人',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT COMMENT='通知公告';

-- ----------------------------
-- Records of notice_announcement
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for notice_contacts
-- ----------------------------
DROP TABLE IF EXISTS `notice_contacts`;
CREATE TABLE `notice_contacts` (
  `id` varchar(36) NOT NULL COMMENT '主键',
  `name` varchar(20) DEFAULT NULL COMMENT '联系人',
  `phone` varchar(11) DEFAULT NULL COMMENT '电话',
  `remark` varchar(100) DEFAULT NULL COMMENT '备注',
  `home_id` varchar(36) DEFAULT NULL COMMENT '机构或单位id',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT COMMENT='一键通知联系人';

-- ----------------------------
-- Records of notice_contacts
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for notice_group
-- ----------------------------
DROP TABLE IF EXISTS `notice_group`;
CREATE TABLE `notice_group` (
  `id` varchar(36) NOT NULL COMMENT '主键',
  `group_name` varchar(50) DEFAULT NULL COMMENT '组名',
  `remark` varchar(100) DEFAULT NULL COMMENT '备注',
  `home_id` varchar(36) DEFAULT NULL COMMENT '机构或单位id',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT COMMENT='一键通知分组';

-- ----------------------------
-- Records of notice_group
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for notice_group_contact
-- ----------------------------
DROP TABLE IF EXISTS `notice_group_contact`;
CREATE TABLE `notice_group_contact` (
  `group_id` varchar(36) DEFAULT NULL COMMENT '分组id',
  `contacts_id` varchar(36) DEFAULT NULL COMMENT '联系人id'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT COMMENT='通知分组和联系人关系表';

-- ----------------------------
-- Records of notice_group_contact
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for notice_record
-- ----------------------------
DROP TABLE IF EXISTS `notice_record`;
CREATE TABLE `notice_record` (
  `id` varchar(36) NOT NULL COMMENT '主键',
  `group_id` varchar(36) DEFAULT NULL COMMENT '组ID',
  `contacts` varchar(20) DEFAULT NULL COMMENT '联系人',
  `phone` varchar(11) DEFAULT NULL COMMENT '电话',
  `state` int DEFAULT NULL COMMENT '状态：1未接通 2未落实 3已落实',
  `time` datetime DEFAULT NULL COMMENT '时间',
  `type` int DEFAULT NULL COMMENT '通知方式：1短信 2语音',
  `contacts_id` varchar(36) DEFAULT NULL COMMENT '联系人id',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT COMMENT='短信、语音记录';

-- ----------------------------
-- Records of notice_record
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for relevant_files
-- ----------------------------
DROP TABLE IF EXISTS `relevant_files`;
CREATE TABLE `relevant_files` (
  `relevant_id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '附属类型的id',
  `file_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '附件名称',
  `file_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '附件地址'
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT COMMENT='相关附件表';

-- ----------------------------
-- Records of relevant_files
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for relevant_units
-- ----------------------------
DROP TABLE IF EXISTS `relevant_units`;
CREATE TABLE `relevant_units` (
  `relevant_id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '附属类型的id',
  `receiving_unit_id` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '接收单位的id',
  `isworkable` tinyint(1) DEFAULT NULL COMMENT '检查任务下发时用：是否落实：0 未落实 1 已落实',
  `workabletime` datetime DEFAULT NULL COMMENT '落实时间',
  `receiving_unit_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_0900_ai_ci DEFAULT NULL COMMENT '接收单位的名称'
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT COMMENT='相关接收单位表';

-- ----------------------------
-- Records of relevant_units
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for safety_knowledge
-- ----------------------------
DROP TABLE IF EXISTS `safety_knowledge`;
CREATE TABLE `safety_knowledge` (
  `id` varchar(36) NOT NULL COMMENT '主键',
  `title` varchar(100) DEFAULT NULL COMMENT '标题',
  `introduction` mediumtext COMMENT '简介',
  `content` mediumtext COMMENT '内容',
  `source` varchar(30) DEFAULT NULL COMMENT '知识来源',
  `time` datetime DEFAULT NULL COMMENT '发布时间',
  `knowledge_type` varchar(36) DEFAULT NULL COMMENT '知识类型：查看知识类型表',
  `path` varchar(255) DEFAULT NULL COMMENT '图片或视频地址',
  `cover` varchar(255) DEFAULT NULL COMMENT '视频封面',
  `state` varchar(1) DEFAULT NULL COMMENT '文章状态：1待发布 2已发布 3待审核 4 未通过 ',
  `creation_time` datetime DEFAULT NULL COMMENT '创建时间',
  `publisher` varchar(255) DEFAULT NULL COMMENT '发布人',
  `org_ids` varchar(500) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL COMMENT '机构ids',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT COMMENT='安全知识';

-- ----------------------------
-- Records of safety_knowledge
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for text_type
-- ----------------------------
DROP TABLE IF EXISTS `text_type`;
CREATE TABLE `text_type` (
  `id` varchar(36) NOT NULL COMMENT '主键',
  `name` varchar(4) DEFAULT NULL COMMENT '分类名称',
  PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci ROW_FORMAT=COMPACT;

-- ----------------------------
-- Records of text_type
-- ----------------------------
BEGIN;
COMMIT;

SET FOREIGN_KEY_CHECKS = 1;
